package com.braveman.im.ui.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.braveman.im.R;
import com.braveman.im.bean.DataListBean;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qmuiteam.qmui.widget.QMUIRadiusImageView;

import java.util.List;

/**
 * 作者：qu zhao xin
 * 邮箱：qu15264880529@163.com
 * 手机号：15264880529
 * 时间：17/10/18 16:27
 */

public class GroupCheckAdapter extends BaseQuickAdapter<DataListBean, BaseViewHolder> {
    private LinearLayout mLlApplication;
    private TextView mLlApplicationText;
    private QMUIRadiusImageView qmuiRadiusImageView;

    public GroupCheckAdapter(int layoutResId, List data) {
        super(layoutResId, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, DataListBean item) {
        helper.setText(R.id.iv_item_company_check_info, item.applicantName);
        helper.setText(R.id.iv_item_company_check_time, item.verificationInformation);
        mLlApplication = helper.getView(R.id.ll_application);
        qmuiRadiusImageView = helper.getView(R.id.iv_item_company_check_head_icon);
        qmuiRadiusImageView.setCircle(false);
        mLlApplicationText = helper.getView(R.id.ll_application_text);
        Glide.with(mContext).load(item.applicantAvatar).into(qmuiRadiusImageView);
//        applicationStatus (string, optional): 申请状态 = ['pending', 'agree', 'refuse']stringEnum:"pending", "agree", "refuse"

        if ("pending".equals(item.applicationStatus)) {
            mLlApplication.setVisibility(View.VISIBLE);
            mLlApplicationText.setVisibility(View.GONE);
        } else if ("agree".equals(item.applicationStatus)) {
            mLlApplication.setVisibility(View.GONE);
            mLlApplicationText.setVisibility(View.VISIBLE);
            mLlApplicationText.setText("已同意");
        } else if ("refuse".equals(item.applicationStatus)) {
            mLlApplication.setVisibility(View.GONE);
            mLlApplicationText.setText("已拒绝");
            mLlApplicationText.setVisibility(View.VISIBLE);
        } else {
            mLlApplication.setVisibility(View.VISIBLE);
            mLlApplication.setVisibility(View.GONE);
        }
    }

}
